package folder.main.exp1.algorithms;

import java.util.Comparator;

import folder.model.network.Network;
import folder.model.network.NetworkPaths;
import folder.model.node.Node;

public class Normal extends Algorithm1
{	
	// Algorithm
	
	public static Normal normal( Network networkPath, int numberNodesSpecial )
	{
		return new Normal( networkPath, numberNodesSpecial );
	}
	
	public Normal( Network networkPath, int numberNodesSpecial )
	{
		super( networkPath, numberNodesSpecial );
		
		this.comparator = new ComparatorNormal();
		
		this.runAlgorithm();
	}
	
	// Comparator
	
    private class ComparatorNormal implements Comparator< Node >
    {
    	@Override
    	public int compare( Node nodeX, Node nodeY )
    	{	
    		Double delayMeanNodeX = nodeX.getDelayToNodeTargetMean();
    		Double delayMeanNodeY = nodeY.getDelayToNodeTargetMean();
    		
    		return -delayMeanNodeX.compareTo( delayMeanNodeY );
    	}
    }

}
